def prime(p):
    if p < 2:
        return False
    elif p == 2:
        return True
    elif p%2 == 0:
        return False
    else:
        for i in range(3,int(p**0.5)+1,2):
            if p%i==0:
                return False
        return True

def PrimeSum(m,n):
    sum = 0
    for i in range(m,n+1):
        if prime(i):
            sum += i
    return sum
m,n=input().split()
m=int(m)
n=int(n)
print(PrimeSum(m,n))